﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="//DocumentTypes">
    <select id="documenttypes">
      <xsl:for-each select="Group">
        <xsl:variable name="categoryid" select="@categoryid"/>
        <xsl:variable name="categoryName" select="@name"/>
        <optgroup label="{$categoryName}">
          <xsl:for-each select="DocumentType">
            <xsl:variable name="documentypecode" select="@id"/>
            <option value="{$documentypecode}">
              <xsl:value-of select="@title"/>
            </option>
          </xsl:for-each>
        </optgroup>
      </xsl:for-each>
    </select>
  </xsl:template>
</xsl:stylesheet>
